#
# import re
# content = "Hello 1234567 world_This" \
#           " is a Regex Demo"
# result = re.match("^Hello.*?(\d+).*Demo$", content, re.S)
# if result:
#     print(result)
#     print(result.group(1))
#     print(result.span())
# else:
#     print("No match found")

#贪婪匹配
# import re
# content = ("川AA63HL")
# result = re.match("^川.*(\d+).*L$",content)
# print(result.group(1))
#
# content = ("川AA38H4L")
# result = re.match("^川.*(\d+).*L$",content)
# print(result.group(1))
#
# content = ("川B63H7L")
# result = re.match("^川.*(\d+).*L$",content)
# print(result.group(1))
#
# content = ("川CCH6M5")
# result = re.match("^川(\w+)(\d+)$", content)
# print(result.group(1))

# #非贪婪匹配
# import re
# content = "我国新冠367例,四川3例!"
# result = re.match("^我.*?(\d+)例.*?(\d).*?!",content)
# print(result.group(1))
# print(result.group(2))

#
# import re
# content = """<li class="mn_li2"><a class="mn_a2" href="https://ehall.cdp.edu.cn/swzx/#/index"><span>网上办事服务大厅</span></a></li><li class="mn_li2"><a class="mn_a2" href="https://aic.cdp.edu.cn"><span>AIC系统（教职工）</span></a>"""
# result = re.match('^<li class="mn_li2">.*?<span>(.*?)</span>',content,re.S)
# print(result.group(1))
#
#
# #re.search
# import re
#
# content = "Hello 1234567 world_This is a Regex Demo Extra stings"
# result = re.search("Hello.*?(\d+).*Demo", content)
# print(result)
# print(result.group(1))
#
# content = """
# <dd><span class="number">1</span><a href="/play/49891/454929.shtml" target="m" title="亲爱的小课桌">亲爱的小课桌</a></dd>
# <dd><span class="number">2</span><a href="/play/795/454553.shtml" target="m" title="悟空">悟空</a></dd>
# <dd><span class="number">3</span><a href="/play/20222/453529.shtml" target="m" title="粉雾海">粉雾海</a></dd>
# <dd><span>4</span><a href="/play/46594/453598.shtml" target="m" title="姐姐真漂亮"> 姐姐真漂亮</a></dd>
# <dd><span>5</span><a href="/play/49518/453225.shtml" target="m" title="斯芬克斯">斯芬克斯</a></dd>
# """
# result = re.search('<dd.*?href="(.*?)".*?>(.*?)</a>', content)
# print(result)
# print(result.group(1))
# print(result.group(2))




# import re
# content = """
# <div class="clearfix cj">
#
# <div class="item">
#                                         <a href="info/1222/29901.htm" target="_blank" title="党委书记余治平带队赴成都国际商贸城调研">
#                                             <span class="_thum"><img src="/__local/E/93/8A/B572ED385205B0C4A74786C8E32_D773A660_16355.jpeg" alt="">
#                                             </span>
#                                             <p class="title">
#                                                 党委书记余治平带队赴成都国际商贸城调研
#                                             </p>
#                                         </a>
#                                     </div>
#
# <div class="item">
#                                         <a href="info/1222/29865.htm" target="_blank" title="成职-朗迅集成电路产业学院成立仪式圆满举行">
#                                             <span class="_thum"><img src="/__local/2/37/D4/A03943AA6D65BD56D03DA1826ED_14F7AFFD_16958.jpeg" alt="">
#                                             </span>
#                                             <p class="title">
#                                                 成职-朗迅集成电路产业学院成立仪式圆满举行
#                                             </p>
#                                         </a>
#                                     </div>
#
# <div class="item">
#                                         <a href="info/1222/29863.htm" target="_blank" title="我校医护学院与四川大学华西第二医院举行合作签约仪式">
#                                             <span class="_thum"><img src="/__local/7/BC/0B/47B65A71E4BAD54A94268D6AF7A_CD1311D7_1019E.jpeg" alt="">
#                                             </span>
#                                             <p class="title">
#                                                 我校医护学院与四川大学华西第二医院举行合作签约仪式
#                                             </p>
#                                         </a>
#                                     </div>
#
# <div class="item">
#                                         <a href="info/1222/29834.htm" target="_blank" title="我校全面启动“进百企、送服务、促就业、谋发展”常态化服务企业专项行动">
#                                             <span class="_thum"><img src="/__local/A/C5/37/43A94A3E8F634425BF0A4486B9A_5EDA84D9_1B77A.jpeg" alt="">
#                                             </span>
#                                             <p class="title">
#                                                 我校全面启动“进百企、送服务、促就业、谋发展”常态化服务企业专项行动
#                                             </p>
#                                         </a>
#                                     </div>
#
# <div class="item">
#                                         <a href="info/1222/29837.htm" target="_blank" title="学校领导率队赴成都市文化广电旅游局推进“校局地”合作共建工作">
#                                             <span class="_thum"><img src="/__local/2/C5/88/3359CB86D1FAE1959ADD4DCA9CC_42F303D3_6C387.jpg" alt="">
#                                             </span>
#                                             <p class="title">
#                                                 学校领导率队赴成都市文化广电旅游局推进“校局地”合作共建工作
#                                             </p>
#                                         </a>
#                                     </div>
#
# <div class="item">
#                                         <a href="info/1222/29793.htm" target="_blank" title="我校智能光电技术应用专业“随企出海”助力马来西亚国家运动会开幕式">
#                                             <span class="_thum"><img src="/__local/F/79/D1/F27F2F0938101E5F814EE90FCF3_EBB57E92_2EEF4.jpeg" alt="">
#                                             </span>
# """
# result = re.findall('<p class="title">(.*?)</p>',content,re.S)
# print(result)
# print(result.group(1))

import re
content = """ 
<dd><span class="number">1</span><a href="/play/49891/454929.shtml" target="m" title="亲爱的小课桌">亲爱的小课桌</a></dd> 
<dd><span class="number">2</span><a href="/play/795/454553.shtml" target="m" title="悟空">悟空</a></dd> 
<dd><span class="number">3</span><a href="/play/20222/453529.shtml" target="m" title="粉雾海">粉雾海</a></dd> 
<dd><span>4</span><a href="/play/46594/453598.shtml" target="m" title="姐姐真漂亮"> 姐姐真漂亮</a></dd> 
<dd><span>5</span><a href="/play/49518/453225.shtml" target="m" title="斯芬克斯">斯芬克斯</a></dd> 
"""
partterns = re.compile("<a.*?>(.*?)</a>",re.S)
items = re.findall(partterns,content)
print(items)



















